﻿@{
    ViewBag.Title = "新建工单";
}
@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.Common.Enums.Certificate
@using ZBJF.Warranty.Common.Enums.InsuranceOrder
@model ZBJF.Warranty.Model.InsuranceWarrantyRecord
@section Header{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
}
<ul id="myTab" class="nav nav-tabs">
    <li class="active">
        <a href="#workOrderInfo" onclick="location.reload();" >
            新建工单
        </a>
    </li>
</ul>
@using (Html.BeginForm("SaveInsuranceWarrantyRecord", "ToBeCreateWorkOrder", FormMethod.Post, new { id = "inputForm", name = "inputForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.ID)
    @Html.HiddenFor(c => c.InsuranceOrderId)
    <h4>保单信息</h4>
    <table class="table table-responsive table-bordered table-hover">
        <tr>
            <th class="w120">保险产品类别：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.InsuranceCategoryName)</td>
            <th class="w120">保险产品名称：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.ProductName)</td>
            <th class="w120">保单状态：</th>
            <td>@ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderStatus), Model.InsuranceOrder.OrderStatus)</td>
        </tr>
        <tr>
            <th>第三方保单号：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.ThirdOrderNO)</td>
            <th>承保公司：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.InsuranceCompany)</td>
            <th>承保公司分公司：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.InsuranceCompanyBranch)</td>
        </tr>
        <tr>
            <th>投保时间：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.CreateOrderTime)</td>
            <th>保险起期：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.EffectiveDate)</td>
            <th>保险止期：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.ServiceEndTime)</td>
        </tr>
        <tr>
            <th>被保险人姓名：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.UserName)</td>
            <th>被保险人电话：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.UserPhone)</td>
            <th>保额：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.InsuredAmount)</td>
        </tr>
        <tr>
            <th>被保险人证件类型：</th>
            <td>@ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(UserCertificateType), Model.InsuranceOrder.CertificateType)</td>
            <th>被保险人证件号码：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.CertificateNO)</td>
            <th>被保险设备类型：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.ProductTypeName)</td>
        </tr>
        <tr>
            <th>设备识别码：</th>
            <td>@(Model.InsuranceOrder.IMEI ?? Model.InsuranceOrder.IDFV)</td>
            <th>被保险设备品牌：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.ProductBrandName)</td>
            <th>被保险设备型号：</th>
            <td>@Html.DisplayFor(o => o.InsuranceOrder.ProductModelName)</td>
        </tr>
    </table>
    <!--保单历史服务信息-->
    @RenderPage("/Views/WorkOrderCommonInfo/InsuranceOrderServiceHistory.cshtml", new { insuranceWarrantyRecordID = Model.ID })
    <!--保单服务项目-->
    <div class="table-responsive dataTables_wrapper">
        <h4>保单服务项目</h4>
        <table class="table table-responsive table-bordered table-hover" id="serviceProjectList">
            <thead>
                <tr>
                    <th>选择</th>
                    <th>服务项目类别</th>
                    <th>服务项目名称</th>
                    <th>单价</th>
                    <th>单位说明</th>
                </tr>
            </thead>
        </table>
    </div>
    <!--销售商信息-->
    @RenderPage("/Views/WorkOrderCommonInfo/InsuranceOrderSellerInfo.cshtml", new { insuranceWarrantyRecordID = Model.ID })
    <p style="font-size: 15px;">报案信息</p>
    <table class="table table-responsive table-bordered table-hover">
        <tr>
            <th class="w200">报案人：<span class="red">*</span></th>
            <td>@Html.TextBoxFor(m => m.Reporter, new { validate = "{required:true,messages:{required:'报案人必填！'}}", @class = "w-p98" })</td>
            <th class="w200">报案人电话：<span class="red">*</span></th>
            <td>@Html.TextBoxFor(m => m.ReporterPhone, new { validate = "{required:true,isTelphone:true,messages:{required:'报案人手机必填！'}}", @class = "w-p98" })</td>
        </tr>
        <tr>
            <th>对接理赔员：</th>
            <td>@Html.TextBoxFor(m => m.InsuranceCompanyLossAdjusterName)</td>
            <th></th>
            <td></td>
        </tr>
    </table>
    <p style="font-size: 15px;">备注信息</p>
    <div>
        @Html.TextAreaFor(m => m.Remark, new { @class = "w-p98" })
    </div>
    <div class="form-actions text-center">
        <input id="btnAuditAndPass" class="btn btn-primary Edit-R @(ViewBag.CanCreatedWarranty == false ? "disabled-element" : "")" title="@(ViewBag.CanCreatedWarranty == false ? "未生效保单或者已经创建报案" : "")" type="submit" value="新建工单">
        <input id="btnSubmit" class="btn margin-l-10" type="button" value="取消 " onclick="javascript: history.back(-1);">
    </div>
}
<script>
    $(function () {
        var objTable = $("#serviceProjectList")
            .dataTable({
                fnDrawCallback: function () {
                    ControlPermissionOperate();
                },
                "aaSorting": [[2, "desc"]],
                "sAjaxSource": "/ToBeCreateWorkOrder/GetServiceProject",
                aoColumns: [
                    {
                        "mData": null,
                        "bSortable": false,
                        "fnRender": function (nRow) {
                            return "<input type='checkbox'>";
                        }
                    },                    
                    { "mData": "ServiceProductType", "bSortable": false },
                    { "mData": "ProjectName", "bSortable": false },
                    { "mData": "Price", "bSortable": false },
                    { "mData": "UnitInstruction", "bSortable": false }
                ]
            });
    });
</script>